//
//  RecommendCollectionViewCell.m
//  艾听歌
//
//  Created by dllo on 16/5/15.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "RecommendCollectionViewCell.h"
#import "HotViewController.h"


@implementation RecommendCollectionViewCell
//初始化
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        //图片
        self.imageView = [[UIImageView alloc] init];
//       self.imageView.backgroundColor = [UIColor whiteColor];
        [self.contentView addSubview:self.imageView];
        self.imageView.dk_backgroundColorPicker = DKColorPickerWithRGB(0xffffff, 0x9c9c9c);
        
        //标题
        self.titleLable = [[UILabel alloc] init];
//        self.titleLable.backgroundColor = [UIColor whiteColor];
        [self.contentView addSubview:self.titleLable];
        
        self.imageView.userInteractionEnabled = YES;
        self.titleLable.userInteractionEnabled = YES;
//        UITapGestureRecognizer *imageTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imageTapAction)];
//        UITapGestureRecognizer *titleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imageTapAction)];
//        
//        [self.imageView addGestureRecognizer:imageTap];
//        [self.titleLable addGestureRecognizer:titleTap];
        
    }
    return self;
}
//- (void)imageTapAction
//{
//    [[NSNotificationCenter defaultCenter] postNotificationName:@"toNewViewController" object:self.toHotViewController];
//    
//    
//    
//}
//布局方法
-(void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes{
    [super applyLayoutAttributes:layoutAttributes];
   self.imageView.frame = CGRectMake(10, 0, layoutAttributes.size.width - 20, layoutAttributes.size.height - 27);
    
    self.titleLable.frame = CGRectMake(10, self.imageView.frame.size.height + 5, self.imageView.frame.size.width , 20);
}

@end
